﻿using System.Collections;
using UnityEngine;

public class SlimeSplitPurpose : Purpose
{
    public override string Text => "分裂";

    public int splitCount = 2;

    public override IEnumerator PurposePerformer()
    {




        // 分裂生成新怪物
        for (int i = 0; i < splitCount; i++)
        {
            Enemy newEnemy = new Enemy()
            {
                Name = enemyView.enemy.Name,
                State = enemyView.enemy.State,
                Health = enemyView.enemy.CurrentHealth,
                CurrentHealth = enemyView.enemy.CurrentHealth
            };

            EnemySystem.Instance.enemyBoardView.AddEnemy(newEnemy);
            // 如果 EnemyView 立即生成，已经在 board 内
        }

        // 移除原怪物
        ActionSystem.Instance.AddReaction(new KillEnemyGA(enemyView));




        yield break; // 协程直接结束
    }
}
